package com.szw.vhrlearn.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import com.szw.vhrlearn.mapper.MenuMapper;
import com.szw.vhrlearn.model.Hr;
import com.szw.vhrlearn.model.Menu;

import java.util.List;

/**
 * @Description
 * @Author 申紫微
 * @Data 2020-03-31 22:41:32
 * @Version 1.0
 */
@Service
public class MenuService {

    @Autowired
    private MenuMapper menuMapper;

    public List<Menu> getMenusByHrId() {

        return menuMapper.getMenusByHrId(((Hr) SecurityContextHolder.getContext()
                .getAuthentication().getPrincipal()).getId());
    }
}
